package com.yf.quartz.domain;



import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author chentianwei
 * @date 2024-11-01 15:17:04
 */
@Getter
@Setter
@TableName("sys_quartz_job")
public class QuartzJob implements Serializable {

    public static final String JOB_KEY = "JOB_KEY";

    @TableId(value = "job_id", type = IdType.AUTO)
    private Long id;

    @TableField(exist = false)
    @Schema(name = "用于子任务唯一标识", hidden = true)
    private String uuid;

    @Schema(name = "定时器名称")
    private String jobName;

    @NotBlank
    @Schema(name = "Bean名称")
    private String beanName;

    @NotBlank
    @Schema(name = "方法名称")
    private String methodName;

    @Schema(name = "参数")
    private String params;

    @NotBlank
    @Schema(name = "cron表达式")
    private String cronExpression;

    @Schema(name = "状态，暂时或启动")
    private Boolean isPause = false;

    @Schema(name = "负责人")
    private String personInCharge;

    @Schema(name = "报警邮箱")
    private String email;

    @Schema(name = "子任务")
    private String subTask;

    @Schema(name = "失败后暂停")
    private Boolean pauseAfterFailure;

    @NotBlank
    @Schema(name = "备注")
    private String description;

    @TableField(value = "create_time",insertStrategy = FieldStrategy.DEFAULT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Timestamp createTime;

    @TableField(value = "update_time",updateStrategy = FieldStrategy.ALWAYS)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Timestamp updateTime;

    @TableField(value = "create_by",insertStrategy = FieldStrategy.DEFAULT)
    private String createBy;

    @TableField(value = "update_by",updateStrategy = FieldStrategy.ALWAYS)
    private String updateBy;
}
